<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE>
<html>
<head>
<meta charset="UTF-8">
<base href="${pageContext.request.contextPath}/">
<title>xxxx</title>

<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="jquery/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="bootstrap/js/bootstrap.min.js"></script>

<!-- 引用jQuery Easyui 文件 -->
<link rel="stylesheet" type="text/css"
	href="easyui/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>

<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" topmargin="2">
	<table width="760" border="0" cellspacing="0" cellpadding="0"
		align="center">
		<tr>
			<td background="images/topback.gif" width="130"><img
				src="images/sitelogo.gif" height="88"></td>
			<td background="images/topback.gif" width="500" align="center"
				valign="middle"><a href="http://www.fans8.com" target="_blank"><img
					src="images/fans8.gif" width="468" height="60" border="0"></a></td>
			<td background="images/topback.gif" width="130">
				<table width="100%" border="0" cellspacing="2" cellpadding="2">
					<tr>
						<td valign="middle" align="center"><a href="cart.jsp"><img
								src="images/button_cart.gif" width="87" height="18" border="0"></a></td>
					</tr>
					<tr>
						<td valign="middle" align="center"><a
							href="checkorder_login.jsp"><img src="images/button_ddcx.gif"
								width="87" height="18" border="0"></a></td>
					</tr>
					<tr>

						<td valign="middle" align="center"><a
							href="customer_register.jsp"><img
								src="images/button_regist.gif" width="87" height="18" border="0"></a></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<table width="760" border="0" cellspacing="1" cellpadding="0"
		align="center" bgcolor="#000000">
		<tr>
			<td bgcolor="#FF9900" height="22" valign="middle" align="center">

				<table width="80%" border="0" cellspacing="2" cellpadding="2">
					<tr align="center" valign="middle">
						<td><a href="newproduct.jsp" class="white">新品快递</a></td>

						<td><a href="commend.jsp" class="white">重点推荐</a></td>

						<td><a href="bestsell.jsp" class="white">销售排行</a></td>

						<td><a href="bestprice.jsp" class="white">特价商品</a></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td bgcolor="#FFCC66" height="22">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td><a href="index.action" class="red">首页</a> &gt; 购物车</td>
						<td>&nbsp;</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<table width="760" border="0" cellspacing="0" cellpadding="0"
		align="center">
		<tr>
			<td><img src="images/yourcart.gif" width="190" height="30">
				<form id="cart-form" method="post" action="">
					<table width="98%" border="0" cellspacing="2" cellpadding="2"
						align="center">
						<tr valign="middle" align="center" bgcolor="#E1E1E1">
							<td height="24" width="27%"><b>商品编号</b></td>
							<td height="24" width="34%"><b>商品名称</b></td>
							<td height="24" width="11%"><b>单价</b></td>
							<td height="24" width="10%"><b>数量</b></td>
							<td height="24" width="18%"><b>合计</b></td>
						</tr>
						<!-- 购物项目开始 -->
						<c:forEach items="${sessionScope.buy.itemList}" var="item">

							<tr align="center" valign="middle">

								<td width="27%">${item.isbn}</td>
								<td width="34%">${item.name}</td>
								<td width="11%">${item.price}元</td>
								<td width="10%">
								<input type="hidden" name="itemIds"
									value="${item.id}"> 
								<input type="text"
									name="quantitys" size="8" maxlength="8"
									value="${item.quantity}">
								</td>
								<td width="18%">${item.totalPrice}元</td>
							</tr>
							<tr align="center" valign="middle">

								<td width="27%">${item.isbn}</td>
								<td width="34%">${item.name}</td>
								<td width="11%">${item.price}元</td>
								<td width="10%">
								<input type="hidden" name="itemIds"
									value="${item.id}"> 
								<input type="text"
									name="quantitys" size="8" maxlength="8"
									value="${item.quantity}">
								</td>
								<td width="18%">${item.totalPrice}元</td>
							</tr>

						</c:forEach>
						<!-- 购物项目结束 -->
						<tr align="center" valign="middle">
							<td colspan="5" bgcolor="#CCCCCC" height="2"></td>
						</tr>
						<tr>
							<td width="27%">&nbsp;</td>
							<td width="34%">&nbsp;</td>
							<td align="right" width="11%" bgcolor="#E0E0E0"><b>总计费用：</b></td>
							<td colspan="2">${sessionScope.buy.totalPrice}元</td>
						</tr>
						<tr align="center" valign="baseline">
							<td></td>
							<td colspan="2"><a id="cart-update"
								href="cart/update.action"> <img src="images/updatecart.gif"
									width="87" height="24"></a> <a href="cart/empty.action"><img
									border=0 src="images/emptycart.gif" width="87" height="24"></a></td>
							<td colspan="2"><a href="userlogin.jsp"><img
									src="images/check.gif" width="120" height="35" border="0"></a></td>
						</tr>
					</table>
				</form></td>
		</tr>
	</table>
	<br>

	<table width="760" border="0" cellspacing="0" cellpadding="0"
		align="center">
		<tr>
			<td background="images/topback.gif" align="center" height="16"><font
				color="#FFFFFF">copyright 2001 Powered by Peter.HJ</font></td>
		</tr>
	</table>

	<script type="text/javascript">
		//阻止浏览器的默认行为 
		function stopDefault(e) {
			//阻止默认浏览器动作(W3C) 
			if (e && e.preventDefault)
				e.preventDefault();
			//IE中阻止函数器默认动作的方式 
			else
				window.event.returnValue = false;
			return false;
		}

		$('#cart-update').click(function(e) {

			stopDefault(e);

			var params = $('#cart-form').serialize();
			
			console.log(params);
			
			$.ajax({
				url:"cart/updat.action?"+params,
				success:function(updateOk){
					if(updateOk=="true"){
						window.location.reload(true);//强制刷新本页内容
					}
				}		
			});
           
		});
	</script>

</body>
</html>